



<div style='display:flex;margin-top:16px'>
	<div style='flex:3;text-align:right'>上传图片：</div>		
	<div style='flex:8'>
		<div id='service_issue_img_upload_view'></div>
		<div style='clear:both'></div>
		<div>
			<input type='file' name='file' id='img_upload' />
		</div>
	</div>


</div>

<script>
function plugin_issue_img_view(){
	$.ajax({
		url:'plugin_issue_img_view.html',
		success:function(res){
			$('#service_issue_img_upload_view').html(res);
		}
	});
	
}
	$(function(){

		if(sessionStorage.issue_img_upload && JSON.parse(sessionStorage.issue_img_upload).length > 0){
			plugin_issue_img_view();
		}
	//	get_issue_imgs();
		//图片选择时上传
		$('#img_upload').change(function(){
			var f = new FormData(document.getElementById('service_issue'));
			$.ajax({
				url:"interface.php",
				data:{
					type:'token',
				},
				success:function(token){
					f.append('token',token);
					$.ajax({
						url:'interface.php?type=img_upload',
						type:'post',
						data:f,			//传送表单数据
						processData:false,	//是否进行序列化处理(必须)
						contentType:false,	//(必须)
						success:function(res){
							switch(res){
								case 'e1':
								case 'e2':
									alert('文件类型不正确aa！');
								break;
								case 'e3':
									alert('最多上传五张图片！');
								break;
								case 'e4':
									alert('图片大小不得超过1M！');
								break;
								default:
									if(sessionStorage.issue_img_upload){
										var arr_str = sessionStorage.issue_img_upload;
										var arr = JSON.parse(arr_str);
										arr.push(res);
										var arr_str = JSON.stringify(arr);
										sessionStorage.issue_img_upload = arr_str;
									}else{
										var arr = new Array();
										arr.push(res);
										var arr_str = JSON.stringify(arr);
										sessionStorage.issue_img_upload = arr_str;
									}
									plugin_issue_img_view();
									//alert(sessionStorage.issue_img_upload);
							}
						}
					});
				}
			});
		});
	});

</script>